<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="showWrite()">document.write</button>
    <button onclick="showAlert()">alert</button>
    <button onclick="showConsoleLog()">console.log</button>
    <script>
        class P{}
        function showWrite(){
            document.write("我会在网页中输出");
            var str = "我是一个普通的变量";
            document.write(str);
            document.write("<h1>" + str + "</h1>");
            var now = new P();
            document.write(now);
        }
        function showAlert(){
            alert("警告:当前系统的温度过高");
            var now = new P();
            alert(now);
        }
        function showConsoleLog(){
            console.log("我会在控制台中显示，网页中看不到");
            var now = new P();
            console.log(now);
        }
    </script>
</body>
</html>